package com.vf.i.mvc.service;

import java.util.List;

import com.jfinal.kit.StrKit;
import com.vf.s.common.model.biz.BizMap;
import com.vf.s.common.model.scene.BizSceneMap;

public class SceneMapService {

	public List<BizMap> gets(String layerId) {
		String whereForMap = "SELECT A.*,'Map' as type  FROM " + BizMap.TABLE_NAME + " A , " + BizSceneMap.TABLE_NAME
				+ " B WHERE A.ID=B.MAPID";
		if (!StrKit.isBlank(layerId)) {
			whereForMap += " AND B.LAYERID='" + layerId + "' ";
		}
		whereForMap += " ORDER BY B.SORT ASC ";
		return  BizMap.dao.find(whereForMap);
	}

	public BizMap get(String entityId) {
		return BizMap.dao.findFirst("select A.*,B.SORT,B.layerId from "+BizMap.TABLE_NAME+" A,"+BizSceneMap.TABLE_NAME+" B where A.ID=B.MAPID AND B.id=? ",entityId);
	}

}
